package com.lsl.builder_pattern;

/**
 * @author Zed
 * @description
 * @date 2022/11/27 14:01
 */
public class MainTest {
    public static void main(String[] args) {
        String[] fileNameArr = {"text", "html"};
        for (String fileName :fileNameArr) {
            if (fileName.equals("text")) {
                System.out.println("编写纯文本文档");
                TextBuilder textBuilder = new TextBuilder();
                Director director = new Director(textBuilder);
                director.construct();
                String result = textBuilder.getResult();
                System.out.println(result);
            }
            if (fileName.equals("html")) {
                System.out.println("编写HTML文档");
                HTMLBuilder htmlBuilder = new HTMLBuilder();
                Director director = new Director(htmlBuilder);
                director.construct();
                String result = htmlBuilder.getResult();
                System.out.println(result + "文件编写完成");
            }

        }
    }
}
